package itzzj.test.Iobyte;

import java.io.*;

/**
 * 字节缓冲流
 */
public class IoByte02 {
    public static void main(String[] args) throws IOException {
        String projectPath = System.getProperty("user.dir");
        // 源文件
        File source = new File(projectPath + "/描述.txt");
        // 目标文件
        File target = new File(projectPath + "/backup-" + source.getName());
        // 缓冲输入流
        InputStream bufInStream = new BufferedInputStream(new FileInputStream(source));
        // 缓冲输出流
        OutputStream bufOutStream = new BufferedOutputStream(new FileOutputStream(target));
        int readSign;
        while ((readSign=bufInStream.read()) != -1){
            bufOutStream.write(readSign);
        }
        bufInStream.close();
        bufOutStream.close();
    }
}
